package text;

import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.control.TextField;
import javafx.scene.control.Tooltip;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

// 单行文本输入框
public class TextFieldDemo extends Application {
	private StackPane root = new StackPane();
	private TextField tf;
	
	public static void main(String[] args) {
		launch(args);
	}
	
	@Override
	public void start(Stage stage) {
		
		root.setPadding(new Insets(30));
		
		tf = new TextField();
		tf.setPromptText("请输入");        // 设置提示字体
		tf.setFocusTraversable(false);
		tf.setTooltip(new Tooltip("这是提示")); // 鼠标停留提示 
		root.getChildren().addAll(tf);
		
		Scene scene = new Scene(root, 300, 250);
		stage.setScene(scene);
		stage.show();
	}
}
